#pragma once






namespace Crows3D
{
   class FrameCounter
   {
   private:
      int            counter;
      int            currentFPS;

      unsigned long  lastSecondStartTime;
      unsigned long  lastFrameTime;

      unsigned long  curMinTime;
      unsigned long  curMaxTime;

      unsigned long  minTime;
      unsigned long  maxTime;

      __int64        lastFrameTimeHighPerf;
      __int64        highPerfCounter;
      __int64        frequency;

   public:
      FrameCounter(void);
      ~FrameCounter(void);

      // Setup timer and begin timing
      // Returns true if successful
      bool Initialize(void);

      // Frame - call on every frame
      // Returns the time since the last frame in ms
      unsigned long Frame(void);


      // Return the current fps during the previous second
      int GetCurrentFPS(void);

      // Return the current max frame time
      unsigned long GetCurrentMaxTime(void);

      // Return the current min frame time
      unsigned long GetCurrentMinTime(void);

      bool          StartHighPerformanceTimer(void);
      int           StopHighPerformanceTimer(void);
   };

}